<template>
  <div class="internship_Guide">
    <c-title text="课程详情" :hide="false"></c-title>
    <template v-if="datalist[active]">
      <div class="guideBox" id="goods_content" v-html="datalist[active].detail_desc"></div>
      <div class="btnBox set-pc-style" @click="tapNext">
        <div class="btn">{{ datalist[active].button_name }}</div>
      </div>
    </template>
  </div>
</template>
<script>
export default {
  data() {
    return {
      datalist: [],
      active: 0
    };
  },
  activated() {
    this.active = 0;
    this.getData();
  },
  methods: {
    async getData() {
      let { data, msg, result } = await $http.post("plugin.cloud-shop.frontend.guide.guideList", {}, "");
      if (result) {
        this.datalist = data;
      } else {
        this.$toast(msg);
      }
    },
    tapNext() {
      console.log(this.active, this.datalist.length - 1);
      if (this.datalist.length - 1 == this.active) {
        this.$router.push(this.fun.getUrl("member", {}));
        return;
      }
      this.active += 1;
    }
  }
};
</script>
<style lang="scss" scoped>
.internship_Guide {
  min-height: 100vh;
  background: #fff;
}
.guideBox {
  margin: 0.63rem;
  padding-bottom: 4rem;
}
.btnBox {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  box-shadow: 0rem -0.03rem 0.31rem 0.03rem #f5f5f5;
  background: #ffffff;
  .btn {
    margin: 0.59rem 0.75rem;
    height: 2.5rem;
    background: #f15353;
    border-radius: 1.28rem;
    text-align: center;
    line-height: 2.5rem;
    font-weight: 500;
    font-size: 0.94rem;
    color: #ffffff;
  }
}
</style>
